<?php
	/**
	 * @package AmpleHarvest
	 */
	namespace ampleharvest\code\usermanager\tables;

	use\ampleharvest\permissions;
	use\ampleharvest\code;

	require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config/cConfig.php';
	require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config/cPermissions.php';

	$config = new \ampleharvest\code\cConfig();
	require_once $config->C_STR_USER_MANAGER_PATH . "/Classes/cTABLE_Keybox.php";
	require_once "cTABLE_Groups.php";

	/**
	 * @brief Adds new actions to the Actions Table in the User Manager database
	 *
	 * - Revision History
	 *  - 0.1
	 * 	 - <b>Date</b>: 24 MAR 2011
	 * 	 - <b>Author</b>: Randy Blancett
	 * 	  - Initial Version
	 *
	 * @author Randy Blancett
	 * @version 0.1
	 * @ingroup code classes table  user_manager
	 */
	class cTABLE_Keybox extends \cTABLE_Keybox
	{
		/**
		 * Inserts default information into the table
		 * Adds Saved Query privleges to known users by default
		 */
		public function insert_DefaultData()
		{
//Known Users
			$this->set_ID("030DB6BE-43D6-466D-A7E2-5ABFDB2AA568");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_COMMENTING_ALL_CRUD);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Identified Users the permission to do create, read, update, delete on comments.");
			
			$this->save_Data2DB();			
			$this->set_ID("5E68EFAB-13DA-48AE-A639-AA7D84588332");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_SAVED_QUERY_ADD);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Identified Users the permission to Save a Query");

			$this->save_Data2DB();

			$this->set_ID("8678F592-D63B-4B54-811C-FA74B5B20BB3");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_SAVED_QUERY_DELETE);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Identified Users the permission to Delete a Query");

			$this->save_Data2DB();

			$this->set_ID("E00FE335-8C84-4334-A329-73EFEDD4F7F3");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_SAVED_QUERY_EDIT);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Identified Users the permission to Edit a Query");

			$this->save_Data2DB();

			$this->set_ID("1144A0EB-AF5A-4847-ABF9-13628759C07E");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_SAVED_QUERY_VIEW);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Identified Users the permission to View a Query");

			$this->save_Data2DB();
			
			$this->set_ID("C5E34D82-3E70-46B5-8553-D7B052E3A57F");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_GROUP_REQUEST);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Identified Users the permission to request a group.");

			$this->save_Data2DB();
//Harvest Request

			$this->set_ID("0805165A-7856-40EC-A629-565A3E663134");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_HR_DEACTIVATE);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_HARVEST_MANAGER);
			$this->set_Comment("Gives Harvest Managers the permission to Deactivate a harvest Request");

			$this->save_Data2DB();

			$this->set_ID("56E3FA82-1765-402A-95E2-EF640921EE31");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_HR_EDIT_ALL_STAGE1);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_HARVEST_MANAGER);
			$this->set_Comment("Gives Harvest Managers the permission to edit all harvest Requests in stage 1");

			$this->save_Data2DB();

			$this->set_ID("8E8B5C11-6393-48CF-BD8F-4C6640001F0F");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_HR_EDIT_ALL_STAGE2);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_HARVEST_MANAGER);
			$this->set_Comment("Gives Harvest Managers the permission to edit all harvest Requests in stage 2");

			$this->save_Data2DB();

			$this->set_ID("A71AC6A4-F123-4337-B4F6-072D3D973579");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_HR_EDIT_DISCUSSIONS);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_HARVEST_MANAGER);
			$this->set_Comment("Gives Harvest Managers the permission to edit Discussions about harvest Requests.");

			$this->save_Data2DB();

			$this->set_ID("2D882D96-453C-48DF-BD45-1E5F243AF4CE");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_HR_EDIT_OWN_STAGE1);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Known Users the permission to edit their own harvest Requests in stage one.");

			$this->save_Data2DB();

			$this->set_ID("6ED4FF7F-05E6-414D-A418-FC73FE236706");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_HR_EDIT_STATUS);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_HARVEST_MANAGER);
			$this->set_Comment("Gives Harvest Managers the permission to the status of harvest Requests.");

			$this->save_Data2DB();

			$this->set_ID("2A5881FA-1DE0-4EC4-B2B2-3ED376D535D7");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_HR_REQUEST_DEACTIVATE_ALL);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_HARVEST_MANAGER);
			$this->set_Comment("Gives Harvest Managers the permission to Request Deactivation of any harvest Request.");

			$this->save_Data2DB();

			$this->set_ID("7519EB75-F898-4C7E-8A4F-462494C1E4F2");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_HR_REQUEST_DEACTIVATE_OWN);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Known Users the permission to Request Deactivation of Their Harvest Requests.");

			$this->save_Data2DB();

			$this->set_ID("B483826D-CD73-4096-92D8-D66E2B29F592");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_HR_SUBMIT);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Known Users the permission to sumbit a Harvest Request.");

			$this->save_Data2DB();

			$this->set_ID("DC8650B5-484F-4069-9476-899A495A4A94");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_HR_VIEW_ALL);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Known Users the permission to view all Harvest Request.");

			$this->save_Data2DB();

			$this->set_ID("D05E39C3-07CA-4F49-8508-D06977473BD4");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_HR_VIEW_DISCUSSIONS);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Known Users the permission to view discussions about Harvest Request.");

			$this->save_Data2DB();

			$this->set_ID("9B6A001A-ADCB-45D8-8E3A-995ACF7144DD");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_STATISTICS_VIEW);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_KNOWN);
			$this->set_Comment("Gives Known Users the permission to view AmpleHarvest Statistics.");

			$this->save_Data2DB();
//Data Manager
			$this->set_ID("6ECB5598-7505-4F25-9727-753CA9631A63");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_DATA_ADD);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_DATA_MANAGER);
			$this->set_Comment("Gives Data Managers the ability to add Data to AmpleHarvest.");

			$this->save_Data2DB();
			
			$this->set_ID("C8C40103-EC0C-44D9-8387-FE8D9A0A8F45");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_DATA_DELETE);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_DATA_MANAGER);
			$this->set_Comment("Gives Data Managers the ability to remove Data to AmpleHarvest.");

			$this->save_Data2DB();
//AmpleHarvest Administrator
			
			$this->set_ID("E16DA06A-3C8F-47B8-8B28-A03903F6DF85");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_ADMIN_VIEW);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_AH_ADMIN);
			$this->set_Comment("Gives AmpleHarvest Administrators the ability to View Admin Functions.");

			$this->save_Data2DB();
			
			$this->set_ID("26CE3257-4BFB-4FB4-B1F2-95BCB0CA9267");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_ADMIN_VIEW_STATUS);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_AH_ADMIN);
			$this->set_Comment("Gives AmpleHarvest Administrators the ability to View Over all status of the system.");

			$this->save_Data2DB();
			

//Group Administrator
			
			$this->set_ID("B2F3E0DA-5204-4ACA-B3D4-61ADFA4E0EBD");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_GROUP_APPROVE);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_AH_GROUP_ADMIN);
			$this->set_Comment("Gives AmpleHarvest Group Administrators the ability to Approve Requests.");

			$this->save_Data2DB();
			
			$this->set_ID("44F992BD-FCD1-4C4D-A1D8-724ACDDDABA0");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_GROUP_EDIT);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_AH_GROUP_ADMIN);
			$this->set_Comment("Gives AmpleHarvest Group Administrators the ability to edit any group.");

			$this->save_Data2DB();
			
			$this->set_ID("D283AF24-312A-4B5A-AC83-9F1CAA0A3447");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_ADMIN_VIEW);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_AH_GROUP_ADMIN);
			$this->set_Comment("Gives AmpleHarvest Group Administrators the ability to view the admin menu.");

			$this->save_Data2DB();
			
			$this->set_ID("57C4ABEC-5B9A-4A43-A367-92B6B476F86B");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_GROUP_VIEW_PENDING);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_AH_GROUP_ADMIN);
			$this->set_Comment("Gives AmpleHarvest Group Administrators the ability to view the pending group requests.");

			$this->save_Data2DB();
			
			$this->set_ID("249AE7E5-36A8-4C09-9710-CD2B70A9EBA4");
			$this->set_ActionID(permissions\cPermissions::C_STR_PERMISION_GROUP_VIEW_INFO);
			$this->set_LinkType(self::c_int_LINKTYPE_GROUP);
			$this->set_LinkID(cTABLE_Groups::C_STR_GROUP_AH_GROUP_ADMIN);
			$this->set_Comment("Gives AmpleHarvest Group Administrators the ability to view data of any group.");

			$this->save_Data2DB();
			
			return true;
		}
	}
?>